import { tool } from "@langchain/core/tools";
import { z } from "zod";

export const weatherTool = tool(
  async (city) => {
    // 对接真实的天气API
    if (!city) return "请输入城市的名字";
    return `${city}： 晴朗，微风，28℃ `;
  },
  {
    name: "weather",
    description:
      "查询城市天气。输入：城市名（中文或英文），例如：北京、Shanghai。",
    schema: z.string(),
  }
);

// 返回今天是星期几：入参任意字符串都行
export const weekdayTool = tool(
  async () => {
    return new Date().toLocaleDateString("zh-CN", { weekday: "long" });
  },
  {
    name: "weekday",
    description: "返回今天是星期几。输入任意字符串即可。",
    schema: z.string(),
  }
);
